<!-- 表格组件 -->
<template>
  <div></div>
</template>

<script>
import { ref } from "vue";

export const useTable = () => {
  const page = ref(1);
  const pageSize = ref(20);
  const total = ref(0);
  const tableData = ref(null);
  const tableLoading = ref(false);
  const searchInfo = ref({});
  const listApi = ref(null);

  const getTableData = () => {
    page.value = 1;
    pageSize.value = 10;
    tableData.value = [];
    total.value = 5;
    tableLoading.value = false;
  };

  const handleSizeChange = (val) => {
    pageSize.value = val;
    getTableData(listApi.value);
  };

  const handleCurrentChange = (val) => {
    page.value = val;
    getTableData(listApi.value);
  };

  return {
    page,
    total,
    pageSize,
    tableData,
    searchInfo,
    tableLoading,
    listApi,
    getTableData,
    handleSizeChange,
    handleCurrentChange,
  };
};
</script>
<style scoped lang="scss"></style>
